// Utility functions
//

#ifndef __UTILI_H__
#define __UTILI_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "Macros.h"

#ifdef NO_RECT_MACRO
int		RectWidth(TRect rect);
int		RectHeight(TRect rect);
#else
#define	RectWidth(rect)		RECT_WIDTH(rect)
#define	RectHeight(rect)	RECT_HEIGHT(rect)
#endif

/*---------------------------------------------------------------------------
 * This printf function is a small implementation of the standard C library
 * function, it does not include all the capabilities of the standard one. 
 * It has been designed to have a small footprint and to be easy to include
 * in an embedded software.  The only external dependency is the putchar() 
 * functions which output a single character to the output device. Once you
 * provide this putchar function, you may link your code with this printf and
 * use it.
 *
 * This printf function will accept integer formats (%d, %x, %X, %u), string
 * format (%s) and character format (%c); left and right alignement, padding
 * with space or 'O'.
 */
int		ut_printf(const char *format, ...);
int		ut_sprintf(char *out, const char *format, ...);

/*---------------------------------------------------------------------------
 * atof may had bug in ADS1.2 or WB's LIB?
 */
float	ut_atof(char* psz);

/*---------------------------------------------------------------------------
 * wince don't has has bsearch() !?
 */
#ifdef WIN_CE
void* __cdecl bsearch(const void *key, const void *base, size_t num,  size_t width, int (__cdecl *compare)(const void *, const void *));
#endif

#ifdef __cplusplus
}
#endif

#endif  // __UTILI_H__
